home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1996 / MacHack 1996.toast / Hacks / Hacks ’92 / Run & Stumpy / source / getfoldername.cp < prev    next >
Encoding:
Text File  |  1992-06-18  |  486 b   |  25 lines  |  [TEXT/MPS ]

  1. #define SystemSevenOrLater    1
  2.  
  3. #include <files.h>
  4. #include <folders.h>
  5.  
  6. #include "getfoldername.h"
  7.  
  8. OSErr getfoldername( OSType id, Str255& name )
  9.   {
  10.     CInfoPBRec pb;
  11.     pb.dirInfo.ioCompletion = 0;
  12.     pb.dirInfo.ioNamePtr = (StringPtr)&name;
  13.     pb.dirInfo.ioFDirIndex = -1;
  14.  
  15.     OSErr error = FindFolder( kOnSystemDisk,
  16.                                       id,
  17.                                       0,
  18.                                       &pb.dirInfo.ioVRefNum,
  19.                                       &pb.dirInfo.ioDrDirID );
  20.     if (error != noErr)
  21.         return error;
  22.     
  23.     return PBGetCatInfoSync( &pb );
  24.   }
  25.